package com.shenmazong.servereduuser.controller;

import com.shenmazong.servereduuser.service.TbAdminService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.AdminVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 军哥
 * @version 1.0
 * @description: 管理员接口
 * @date 2021/9/22 14:42
 */

@Api(tags = {"管理员API接口"})
@RestController
@Slf4j
@RequestMapping(value = "/admin")
public class TbAdminController {

    @Autowired
    private TbAdminService adminService;

    @ApiOperation(value="增加管理员", notes="增加管理员", produces="application/json")
    @PostMapping(value = "/add")
    public ResultResponse add(@RequestBody AdminVo admin) {
        return adminService.add(admin);
    }

    @ApiOperation(value="删除管理员", notes="删除管理员", produces="application/json")
    @PostMapping(value = "/del")
    public ResultResponse del(@RequestBody AdminVo admin) {
        return adminService.del(admin);
    }

    @ApiOperation(value="获取管理员信息", notes="获取管理员信息", produces="application/json")
    @PostMapping(value = "/get")
    public ResultResponse get(@RequestBody AdminVo admin) {
        return adminService.get(admin);
    }

    @ApiOperation(value="修改管理员密码", notes="修改管理员密码", produces="application/json")
    @PostMapping(value = "/set")
    public ResultResponse set(@RequestBody AdminVo admin) {
        return adminService.set(admin);
    }

    @ApiOperation(value="管理员登录", notes="管理员登录", produces="application/json")
    @PostMapping(value = "/login")
    public ResultResponse login(@RequestBody AdminVo admin) {
        return adminService.login(admin);
    }
}
